{extend name="admin/public/base"}
{block name="x-body"}
<!--pagetitle-->
<div class="row">
    <div class="col-12">
        <div class="page-title-box">
            <div class="page-title-right">
                <ol class="breadcrumb m-0">
                    <li class="breadcrumb-item"><a href="#">管理员管理</a></li>
                    <li class="breadcrumb-item active">管理员列表</li>
                </ol>
            </div>
            <h4 class="page-title">管理员列表</h4>
        </div>
    </div>
</div>
<!--table-->
<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <button type="button" class="btn btn-primary mb-3"  data-toggle="modal" data-target="#addcontactmodal"> <i class="mdi mdi-account-plus mr-1"></i> 添加管理员</button>

                条件<input name="search" type="text"/>
                <table id="basic-datatable" class="table table-hover dt-responsive nowrap table-centered">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>用户名</th>
                        <th>手机号</th>
                        <th>邮箱</th>
                        <th>创建时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>

            </div> <!-- end card-body-->
        </div> <!-- end card -->
    </div> <!-- end col -->
</div>
<script>
    $(document).ready(function (e) {
        var table = $('#basic-datatable').DataTable({
            serverSide: true,
            "language": {
                "sProcessing":   "<img src='__STATIC__/assets/images/loading.gif'>",
                "lengthMenu": "每页 _MENU_ 条记录",
                "zeroRecords": "没有找到记录",
                "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
                "infoEmpty": "无记录",
                "sSearch":       "搜索:",
                "sLoadingRecords":"加载中...",
                "infoFiltered": "(从 _MAX_ 条记录过滤)",
                "oPaginate": {
                    "sFirst":    "<<",
                    "sPrevious": "<",
                    "sNext":     ">",
                    "sLast":     ">>"
                },
                "oAria": {
                    "sSortAscending":  ": 以升序排列此列",
                    "sSortDescending": ": 以降序排列此列"
                }
            },
            searching: true,
            bProcessing : true,
            pagingType:"full_numbers",
            ajax:{
                url:'/admin/user/indexdata',
                type:'get',
                async:true,
            },
            columns:[
                { "data": "id",searchable: false},
                { "data": "username",searchable: true },
                { "data": "phone",searchable: true },
                {"data":"email",searchable: true},
                {"data":"create_time",searchable: false},
                {"data":"status",searchable: false},
                {searchable: false,"render":function (data) {
                     return '<div class="btn-group dropdown"><a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a><div class="dropdown-menu dropdown-menu-right"><a class="dropdown-item" href="#"><i class="mdi mdi-pencil mr-1 text-muted"></i>编辑</a><a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-1 text-muted"></i>删除</a></div></div>';
                    }}
            ],
        });
        $("input[name='search']").keyup(function (res) {
            table.columns('.username').search($(this).val(),true,false).draw();
        })
    })
</script>

{/block}